/**
 */
package wcomm_v1.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import wcomm_v1.ActivityDefinition;
import wcomm_v1.Attribute;
import wcomm_v1.EventGeneration;
import wcomm_v1.MsgDefinition;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Activity Definition</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.ActivityDefinitionImpl#getAttributes <em>Attributes</em>}</li>
 *   <li>{@link wcomm_v1.impl.ActivityDefinitionImpl#getEvents <em>Events</em>}</li>
 *   <li>{@link wcomm_v1.impl.ActivityDefinitionImpl#getInMessages <em>In Messages</em>}</li>
 *   <li>{@link wcomm_v1.impl.ActivityDefinitionImpl#getOutMessages <em>Out Messages</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ActivityDefinitionImpl extends DocumentableElementImpl implements ActivityDefinition
{
  /**
   * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAttributes()
   * @generated
   * @ordered
   */
  protected EList<Attribute> attributes;

  /**
   * The cached value of the '{@link #getEvents() <em>Events</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEvents()
   * @generated
   * @ordered
   */
  protected EList<EventGeneration> events;

  /**
   * The cached value of the '{@link #getInMessages() <em>In Messages</em>}' reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInMessages()
   * @generated
   * @ordered
   */
  protected EList<MsgDefinition> inMessages;

  /**
   * The cached value of the '{@link #getOutMessages() <em>Out Messages</em>}' reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOutMessages()
   * @generated
   * @ordered
   */
  protected EList<MsgDefinition> outMessages;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ActivityDefinitionImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.ACTIVITY_DEFINITION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Attribute> getAttributes()
  {
    if (attributes == null)
    {
      attributes = new EObjectContainmentEList<Attribute>(Attribute.class, this, Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES);
    }
    return attributes;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<EventGeneration> getEvents()
  {
    if (events == null)
    {
      events = new EObjectContainmentEList<EventGeneration>(EventGeneration.class, this, Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS);
    }
    return events;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<MsgDefinition> getInMessages()
  {
    if (inMessages == null)
    {
      inMessages = new EObjectResolvingEList<MsgDefinition>(MsgDefinition.class, this, Wcomm_v1Package.ACTIVITY_DEFINITION__IN_MESSAGES);
    }
    return inMessages;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<MsgDefinition> getOutMessages()
  {
    if (outMessages == null)
    {
      outMessages = new EObjectResolvingEList<MsgDefinition>(MsgDefinition.class, this, Wcomm_v1Package.ACTIVITY_DEFINITION__OUT_MESSAGES);
    }
    return outMessages;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES:
        return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS:
        return ((InternalEList<?>)getEvents()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES:
        return getAttributes();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS:
        return getEvents();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__IN_MESSAGES:
        return getInMessages();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__OUT_MESSAGES:
        return getOutMessages();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES:
        getAttributes().clear();
        getAttributes().addAll((Collection<? extends Attribute>)newValue);
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS:
        getEvents().clear();
        getEvents().addAll((Collection<? extends EventGeneration>)newValue);
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__IN_MESSAGES:
        getInMessages().clear();
        getInMessages().addAll((Collection<? extends MsgDefinition>)newValue);
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__OUT_MESSAGES:
        getOutMessages().clear();
        getOutMessages().addAll((Collection<? extends MsgDefinition>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES:
        getAttributes().clear();
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS:
        getEvents().clear();
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__IN_MESSAGES:
        getInMessages().clear();
        return;
      case Wcomm_v1Package.ACTIVITY_DEFINITION__OUT_MESSAGES:
        getOutMessages().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ACTIVITY_DEFINITION__ATTRIBUTES:
        return attributes != null && !attributes.isEmpty();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__EVENTS:
        return events != null && !events.isEmpty();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__IN_MESSAGES:
        return inMessages != null && !inMessages.isEmpty();
      case Wcomm_v1Package.ACTIVITY_DEFINITION__OUT_MESSAGES:
        return outMessages != null && !outMessages.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ActivityDefinitionImpl
